
class GameMap extends Laya.Sprite {
    private _map: Laya.Sprite
    private _myParent: Core.BaseSpriteLayer

    constructor(parent: Core.BaseSpriteLayer) {
        super()
        this._myParent = parent
        this._myParent.addChild(this)
    }

    public initMap(mapName: string) {
        var texture: Laya.Texture = App.ResourceUtils.getRes(mapName)
        this._map = new Laya.Sprite()
        this._map.texture = texture
        this.addChild(this._map)

        var role = new ui.role.roleUI()
        this.addChild(role)

        var scene = this.addChild(new Laya.Scene())
        var camera: Laya.Camera = scene.addChild(new Laya.Camera(0, 0.1, 100)) as Laya.Camera
        camera.transform.translate(new Laya.Vector3(0, 0.5, 1))
        camera.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false)

        var role3D = scene.addChild(Laya.Sprite3D.load("LayaScene_layaScene/layaScene.lh"))
    }

    public lookAt(x: number, y: number): void {
        this.x = -(x - this._myParent.width / 2)
        this.y = (y + this._myParent.height / 2) - this._map.texture.height
    }
}